package com.codi.bus.core.dao.impl;

import com.codi.base.dao.plugin.page.PageView;
import com.codi.base.dao.v2.GeneratedBaseDaoImpl;
import com.codi.bus.core.dao.UserFeedbackDao;
import com.codi.bus.core.domain.User;
import com.codi.bus.core.domain.UserFeedback;
import com.codi.bus.core.service.model.UserFeedbackModel;
import org.apache.commons.beanutils.BeanMap;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @DESCRIBE
 * @Author sungaoxiang [sungaoxiang@cd121.com]
 * @DATE 2017/10/13 15:25
 **/
@Repository("userFeedbackDao")
public class UserFeedbackDaoImpl extends GeneratedBaseDaoImpl<UserFeedback> implements UserFeedbackDao {
    @Override
    public List<UserFeedback> queryList(Integer pageIndex, Integer pageSize, UserFeedbackModel model) {
        PageView pageView = new PageView();
        pageView.setPageNow(pageIndex);
        pageView.setPageSize(pageSize);
        Map<Object, Object> param = new HashMap<>();
        param.put("pageView", pageView);
        param.putAll(new BeanMap(model));
        List<UserFeedback> list = this.findList(generateStatement("queryList"), param);
        return list;
    }

    @Override
    public Integer queryCount(UserFeedbackModel model) {
        return this.getSqlSession().selectOne(generateStatement("queryListCount"),model);
    }
}
